package com.gel.aiagent.controller;

import com.gel.aiagent.convention.result.Result;
import com.gel.aiagent.convention.result.Results;
import com.gel.aiagent.dao.UserDO;
import com.gel.aiagent.dto.req.UserRegisterDTO;
import com.gel.aiagent.service.UserService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
@RequiredArgsConstructor
public class UserController {

    private final UserService userService;

    /*注册*/
    @PostMapping("/register")
    public Result<Void> register(@RequestBody UserRegisterDTO requestParam){
        userService.register(requestParam);
        return Results.success();

    }

    /*登录*/

    @PostMapping("/login")
    public Result<String> login(@RequestBody UserRegisterDTO requestParam){
        return Results.success(userService.login(requestParam));
    }

    /*退出登录*/
}
